package com.kk.score.service.impl;

import com.kk.score.entity.DepartmentEntity;
import com.kk.score.entity.vo.TaskPersonVo;
import com.kk.score.entity.vo.TaskVo;
import com.kk.score.utils.PageUtils;
import com.kk.score.utils.Query;
import com.kk.score.utils.SpringSecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Map;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import com.kk.score.dao.TaskDao;
import com.kk.score.entity.TaskEntity;
import com.kk.score.service.TaskService;
import org.springframework.util.StringUtils;


@Service("taskService")
public class TaskServiceImpl extends ServiceImpl<TaskDao, TaskEntity> implements TaskService {

    @Autowired
    private TaskDao taskDao;

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
//        String status = (String) params.get("status");
//        if (!StringUtils.hasText(status)) {
//            status = "0";
//        }
        String userUid = SpringSecurityUtils.getUid();
        return new PageUtils(taskDao.findTaskAllByUser(new Query<TaskVo>().getPage(params), userUid, null));
    }

    @Override
    public PageUtils queryPersonList(Map<String, Object> params) {
        return new PageUtils(taskDao.findTaskPersonByPushUid(new Query<TaskPersonVo>().getPage(params), (String) params.get("uid")));
    }

}